import api from '../../api'

export default {
    namespaced: true,
    state: {
        detail: {},
        knowledgeList: [],
    },
    mutations: {
        set_detail(state, payload) {
            state.detail = payload;
        },
        set_knowledgeList(state, payload) {
            state.knowledgeList = payload;
        },

    },
    actions: {
        // 获取详情
        getKnowledgeDetail(context, data) {
            api.getKnowledgeDetail(data).then(res => {
                if (res.success) {
                    context.commit('set_detail', res.data)
                }
            })
        },
        // 获取知识小册列表
        getKnowledgeList(context, data) {
            api.getKnowledgeList(data).then(res => {
                if (res.success) {
                    context.commit('set_knowledgeList', res.data.data)
                }
            })
        },
    },
}